<template>
  <!--pdf展示-->
  <div id="learnDetail">
    <!-- <div v-if="queryObj.file_type===1">
      {{taskLearn.file_name}}
      <web-view :src="taskLearn.access_path"></web-view>
    </div>-->
    <div class="detail-content">
      <div style="text-align: center;">{{taskLearn.material_name}}</div>
      <div v-html="taskLearn.material_content"></div>
      <!-- <div v-html="taskLearn.material_desc"></div> -->
    </div>
    <van-toast id="van-toast" />
  </div>
</template>
<script>
import { get } from "../../utils/request";
import { setStorage, getStorage } from "../../utils/storage";
import Toast from "../../../static/vant/toast/toast";
export default {
  data() {
    return {
      taskLearn: {},
      isLogin: false,
      openid: "",
      queryObj: {
        com_id: "",
        file_type: ""
      }
    };
  },
  onLoad(e) {
    // this.queryObj.com_id = e.com_id
    // this.queryObj.file_type = e.file_type
    this.fnDetail(e.com_id, e.file_type);
  },
  mounted() { },
  methods: {
    toScan() {
      wx.navigateTo({
        url: "/pages/scan/main"
      });
    },
    /*
    * 接口 任务详情页中培训学习点击接口
    * 参数 id 任务ID
    * type 1未提交答案查看 2已提交答案查看
   */
    fnDetail(id, type) {
      this.$http
        .post({
          url: "/mobile/api/file/detail",
          data: {
            com_id: id,
            file_type: type
          }
        })
        .then(res => {
          if (res.code == "RX0000") {
            this.taskLearn = res.data;
          } else {
            wx.showToast({
              title: res.data
            });
          }
        });
    }
  }
};
</script>
<style lang="less">
#learnDetail {
  padding: 28px 15px;
  .detail-content {
    color: #333;
    font-size: 14px;
  }
}
</style>

